/**
 * @Author: jichang
 * @Date: 2024/10/28 16:17:51
 * @LastEditors: jichang
 * @LastEditTime: 2024/10/28 16:17:51
 * Description: ATM消息，定义状态机的一系列节点
 */
#pragma once

#include <string>
#include "sender.hpp"

struct withdraw {
    withdraw(std::string const& acount_, unsigned amount_, 
        messaging::sender atm_queue_):
        account(acount_), amount(amount_), 
        atm_queue(atm_queue_) { }


    std::string account;
    unsigned amount;
    mutable messaging::sender atm_queue;
};

struct withdraw_ok { };

struct withdraw_denied { };

struct cancel_withdrawal {
    cancel_withdrawal(std::string const& account_, unsigned amount_):
        account(account_), amount(amount_) { }

    std::string account;
    unsigned amount;
};

struct withdrawal_processed {
    withdrawal_processed(std::string const& account_, unsigned amount_):
        account(account_), amount(amount_) { }

    std::string account;
    unsigned amount;
};

struct card_inserted {
    explicit card_inserted(std::string const& account_): account(account_) { }
    std::string account;
};

struct digit_pressed {
    explicit digit_pressed(char digit_): digit(digit_) { };
    char digit;
};

struct clear_last_pressed { };

struct eject_card { };

struct withdraw_pressed {
    explicit withdraw_pressed(unsigned amount_): amount(amount_) { }
    unsigned amount;
};

struct cancel_pressed { };

struct issue_money {
    issue_money(unsigned amount_): amount(amount_) { }
    unsigned amount;
};

struct verify_pin {
    verify_pin(std::string const& account_, 
        std::string const& pin_, 
        messaging::sender atm_queue_):
        account(account_), pin(pin_), atm_queue(atm_queue_) { }
    std::string account;
    std::string pin;
    mutable messaging::sender atm_queue;
};

struct pin_verified { };

struct pin_incorrect { };

struct display_enter_pin { };

struct display_enter_card { };

struct display_insufficient_funds { };

struct display_withdrawal_cancelled { };

struct display_pin_incorrect_message { };

struct display_withdrawal_options { };

struct get_balance {
    get_balance(std::string const& account_, messaging::sender atm_queue_):
        account(account_), atm_queue(atm_queue_) { }

    std::string account;
    mutable messaging::sender atm_queue;
};

struct balance {
    explicit balance(unsigned amount_): amount(amount_) { }
    unsigned amount;
};

struct display_balance {
    explicit display_balance(unsigned amount_): amount(amount_) { }
    unsigned amount;
};

struct balance_pressed { };